﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using WCS.Infrastructure.Dto.Common;

namespace WCS.Infrastructure.Dto.Request.Coupon
{
    /// <summary>
    /// 优惠券核销记录请求DTO
    /// </summary>
    public class CouponConsumptionRecordRequestDto:BaseRequestDto
    {

        /// <summary>
        /// 核销记录ID
        /// </summary>
        [Key]
        [StringLength(32)]
        public string Id { get; set; } = null!;

        /// <summary>
        /// 关联优惠券实例ID
        /// </summary>
        [StringLength(32)]
        public string CouponInstanceId { get; set; } = null!;

        /// <summary>
        /// 关联订单ID
        /// </summary>
        [StringLength(32)]
        public string OrderId { get; set; } = null!;

        /// <summary>
        /// 核销时间
        /// </summary>
        [Column(TypeName = "timestamp(6) without time zone")]
        public DateTime ConsumptionTime { get; set; }

        /// <summary>
        /// 核销方式：1=线下POS扫码核销，2=线上支付自动核销，3=小程序手动选择核销，4=API接口核销，5=客服手动核销，6=系统自动核销（满足条件时）
        /// </summary>
        public int? ConsumptionType { get; set; }

        /// <summary>
        /// 核销收款码ID
        /// </summary>
        [StringLength(32)]
        public string? ConsumptionCodeId { get; set; }

        /// <summary>
        /// 核销设备信息
        /// </summary>
        [StringLength(64)]
        public string? ConsumptionDevice { get; set; }

        /// <summary>
        /// 核销IP地址
        /// </summary>
        [StringLength(45)]
        public string? ConsumptionIp { get; set; }

        /// <summary>
        /// 是否已撤销（true=核销后因退款等原因撤销，false=正常核销）
        /// </summary>
        public bool IsCanceled { get; set; }

        /// <summary>
        /// 撤销时间（若撤销，记录撤销的时间）
        /// </summary>
        [Column(TypeName = "timestamp(6) without time zone")]
        public DateTime? CancelTime { get; set; }

        /// <summary>
        /// 撤销原因（如“用户退款”“核销错误”等）
        /// </summary>
        [StringLength(255)]
        public string? CancelReason { get; set; }

        /// <summary>
        /// 用户ID
        /// </summary>
        [StringLength(32)]
        public string? UserId { get; set; }


        /////////////////////////////////////////////////////////////////////////

    }
}
